<?php
/**
 * Created by 项目.
 * User: xuguopeng
 * Date: 2020-06-28
 * Time: 11:17
 */

namespace app\api\model;


use think\model\concern\SoftDelete;

class GoodsSort extends BaseModel
{
    use SoftDelete;

    public function img()
    {
        return $this->belongsTo('Image','img_id','id');
    }

    // 关联
    public function recommends()
    {
        return $this->hasMany('Goods','sort_id','id')
            ->where('recommend',1)
            ->where('up_down',1)
            ->order('order_sort desc');
    }
}